﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Batman.Jianbei.Forum.Migrations.JianbeiForumDbContext2Migrations
{
    public partial class _201902171 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Topic",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Description = table.Column<string>(maxLength: 120, nullable: true),
                    IsOnline = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    CreateAt = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    PartitionId = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Topic", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Topic_Partition_PartitionId",
                        column: x => x.PartitionId,
                        principalTable: "Partition",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Topic_PartitionId",
                table: "Topic",
                column: "PartitionId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Topic");
        }
    }
}
